Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a helper for nonconflicting, multihost-safe filenames #2424

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

happz
Copy link
Collaborator

@happz happz commented Oct 23, 2023

Since we entered the realms of multihost and parallel executions of phases, we need filenames that, when used by a phase on multiple guests or by one plugin executed multiple times, would allow for now race conditions. We cannot afford a phase overwriting a script wrapper or guest topology.

There are already two places where such files are constructed, two more are in pending pull requests, one is clearly missing, and more will be needed when we start exposing guest facts to guest-setup playbooks. Or to prepare/feature plugin.

So, to avoid confusion about how such a file should be called, there's a helper function. If we ever get Pyright, together with a NewType we might be able to prevent using non-unique filenames where safe ones are needed.

Patch requires a bit of refactoring of guest topology saving, but nothing serious.

Pull Request Checklist

  • implement the feature
  • write the documentation

@happz happz added code | style Code style changes not affecting functionality area | multihost Issues related to the multihost testing support labels Oct 23, 2023
@happz happz added this to the 1.30 milestone Oct 23, 2023
@happz happz force-pushed the safe-multihost-name-helper branch 3 times, most recently from 6c3e6f1 to 585e588 Compare November 7, 2023 17:53
Copy link
Collaborator

@psss psss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup! @happz, anything else from the check list you still keep as a todo item or everything done?

@psss psss self-assigned this Nov 14, 2023
@happz
Copy link
Collaborator Author

happz commented Nov 14, 2023

Thanks for the cleanup! @happz, anything else from the check list you still keep as a todo item or everything done?

Not really, no. Rebased, fixed the conflict, and we're good to go. I believe we will cover this once we start moving tmt-generated files - test wrapper, AVC logs, guest logs, etc. - into a directory as we discussed recently, that will offer plenty of opportunities to verify all files are named correctly.

Since we entered the realms of multihost and parallel executions of
phases, we need filenames that, when used by a phase on multiple guests
or by one plugin executed multiple times, would allow for now race
conditions. We cannot afford a phase overwriting a script wrapper or
guest topology.

There are already two places where such files are constructed, two more
are in pending pull requests, one is clearly missing, and more will be
needed when we start exposing guest facts to guest-setup playbooks. Or
to `prepare/feature` plugin.

So, to avoid confusion about how such a file should be called, there's a
helper function. If we ever get Pyright, together with a `NewType` we
might be able to prevent using non-unique filenames where safe ones are
needed.

Patch requires a bit of refactoring of guest topology saving, but
nothing serious.
@psss psss merged commit 8d7c415 into main Nov 14, 2023
16 checks passed
@psss psss deleted the safe-multihost-name-helper branch November 14, 2023 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area | multihost Issues related to the multihost testing support code | style Code style changes not affecting functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants